//
// Created by wangyihu2020 on 2022/6/24.
//

#ifndef FEM_OPENGL_SPARSE_MATRIX_H
#define FEM_OPENGL_SPARSE_MATRIX_H
#include <Types.h>
//#include <window.h>
//class window;
//void window::runFEM();
class Sparse_Matrix{
//    friend void window::runFEM();
public:
    enum matrixType{CSC_MATRIX, CSR_MATRIX};
protected:
    qp_float* m_data;
    qp_int* m_row;
    qp_int* m_col;
    qp_int m_dataSize;
    qp_int m_colSize;
    qp_float m_threshold = 0.000001;
    qp_int m_maxSize = 100000;
    qp_int m_rowSize;
    qp_float m_maxElm;
    matrixType m_type;

public:
    Sparse_Matrix() = default;
    virtual ~Sparse_Matrix();
    qp_int getDataSize() const;
    qp_int getColSize() const;
    qp_int getRowSize() const;
    qp_float* getData() const;
    qp_int* getRow() const;
    qp_int* getCol() const;

    Sparse_Matrix* transpose(Sparse_Matrix*);
    Sparse_Matrix* transpose(Sparse_Matrix&);
    void setDataSize(qp_int);
    void setColSize(qp_int);
    void setRowSize(qp_int);
    void writeData(qp_int, qp_float);
    void writeRow(qp_int, qp_int);
    void writeCol(qp_int, qp_int);
    virtual void printCol() const = 0;
    virtual void printRow() const = 0;
    void printData() const;
    volatile void printAll() const;



};
#endif //FEM_OPENGL_SPARSE_MATRIX_H
